//1.引入HTTP组件
let http = require('http');
//2.创建服务器
let Server = http.createServer((req,res)=>{
    if(req.url == '/favicon.ico'){
        return;
    }
    res.setHeader('Content-Type','text/plain;charset=utf-8')
    if(req.url == '/'|| req.url == '/index'){
        res.end('<h1>首页</h1>');
    }else if(req.url == '/login'){
        res.end('登入界面');
    }else if(req.url == '/reg'){
        res.end('注册界面');
    }else if(req.url == '/user'){
        res.end('用户中心');
    }else{
        res.end('404');
    }
})
//3.绑定端口
Server.listen(80,'www.myphp8866.com',()=>{
    console.log('服务器已启动，打开浏览器输入网址：www.myphp8866.com');
})